package com.sfc.sdsr.common.model;

import java.io.Serializable;

public class EventAttendance implements Serializable, Comparable<EventAttendance> {

	private static final long serialVersionUID = 0xDEADBEEFBABE7609L;

	private Person person;
	private Event event;
	private EventRole eventRole;

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public Event getEvent() {
		return event;
	}

	public void setEvent(Event event) {
		this.event = event;
	}

	public EventRole getEventRole() {
		return eventRole;
	}

	public void setEventRole(EventRole eventRole) {
		this.eventRole = eventRole;
	}

	public String getPrimaryKey() {
		return person.getPersonUuid()+""+event.getEventUid();
	}
	
	@Override
	public int compareTo(EventAttendance eventAttendance) {
		if (this == eventAttendance) {
			return 0;
		}
		
		String otherEventAttandance = eventAttendance.getPrimaryKey();
		String thisEventAttendance = getPrimaryKey();
		
		return thisEventAttendance.compareTo(otherEventAttandance);
	}
	
	@Override
	public String toString() {
		return "EventAttendance: " + person.getPersonUuid() + ", " + event.getEventUid();
	}
}
